package com.qf;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by luoxinmin on 2020/6/8.
 */
@WebServlet("/test")
public class TestServlet  extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ApplicationContext ac=new ClassPathXmlApplicationContext("application.xml");
        Car car=ac.getBean("cars",Car.class);
        System.out.println(car.getName());
    }
}
